/**
 * Created by Administrator on 2015/11/26.
 */
    function css(obj,name,value){
        if(arguments.length==2){//两个参数
            return obj.style[name];
        }
        else//三个参数
        {
            obj.style[name]=value;
        }
    }
    /*搜索框*/
    var oTxt=document.getElementsByClassName('search-text')[0];
    oTxt.onfocus=function(){
        if(this.value=='搜索菜谱、食材...')
            this.value='';
    }
    oTxt.onblur=function(){
        if(this.value==''){
            this.value='搜索菜谱、食材...';
        }
    }


    /*用户下拉框*/
    var oPanel=document.getElementsByClassName("quick-panel")[0];
    var aTag=document.getElementById("aHover")
    if(aTag){
        aTag.onmouseover=function(){
            oPanel.style.display="block";
        }
        aTag.onmouseout=function(){
            oPanel.style.display="none";
        }
    }


//导航栏颜色切换
 var　oNav=document.getElementById('nav');
 var aA=oNav.getElementsByTagName('a');
var urlStr=window.location.href;
//alert(url)
var fitUrl=urlStr.split('/')[3];

(function toActive() {
    if (fitUrl == "") {
            aA[0].className="active";
    }
    if(fitUrl=="recipe"){
        aA[1].className="active";

    }
    if(fitUrl=="menu"){
          aA[2].className='active';

    }
})();